<?php
/**
 * 查询QQ信息
 * @project berfen
 * @copyright 院主互联网数据
 * @author yuanzhumc
 * @version 2.0
 * @date: 2021/5/27
 * @createTime 9:10
 * @filename index.php
 * @product_name PhpStorm
 * @link
 * @example
 */

$receive_data=[
    'qq'=>'2144680883'
];

$urlPre = 'http://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?g_tk=1518561325&uins=';
$data = file_get_contents($urlPre .$receive_data['qq']);
$data = iconv("GB2312", "UTF-8", $data);
$pattern = '/portraitCallBack\((.*)\)/is';
preg_match($pattern, $data, $result);
$result_data=[
    'qq'=>$receive_data['qq'],
    'headimg'=>"http://q1.qlogo.cn/g?b=qq&nk=".$receive_data['qq']."&s=100&t=1547904810",
    'name'=>json_decode($result[1], true)[$receive_data['qq']][6],
    'email'=>$receive_data['qq']."@qq.com"
];
print_r($result_data);